package com.fr.chicken.util.SmsUtils;

import java.io.UnsupportedEncodingException;
import com.alibaba.fastjson.JSON;

public class SendSms {
	public static final String charset = "utf-8";
	// 用户平台API账号(非登录账号,示例:N1234567)
	public final static String account = "N2352240";
	// 用户平台API密码(非登录密码)
	public final static String pswd = "KIWR7kANgmf7ee";
	//请求地址请登录253云通讯自助通平台查看或者询问您的商务负责人获取
	public final static String smsVariableRequestUrl = "http://smssh1.253.com/msg/send/json";
	public static void sendSms(String phone,String code) throws UnsupportedEncodingException {

				//短信内容
				String msg = "【全民鸡场】亲爱的用户，您的短信验证码为"+code+"，1分钟内有效，若非本人操作请忽略。";
				//状态报告
				String report= "true";

				SmsSendRequest smsSingleRequest = new SmsSendRequest(account, pswd, msg, phone,report);

				String requestJson = JSON.toJSONString(smsSingleRequest);

				System.out.println("before request string is: " + requestJson);

				String response = ChuangLanSmsUtil.sendSmsByPost(smsVariableRequestUrl, requestJson);

				System.out.println("response after request result is :" + response);

				SmsSendResponse smsSingleResponse = JSON.parseObject(response, SmsSendResponse.class);

				System.out.println("response  toString is :" + smsSingleResponse);
	}
}
